<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title></title>
    <link rel="stylesheet" href="${css}/pintuer.css">
    <link rel="stylesheet" href="${css}/admin.css">
    <link rel="stylesheet" href="${css}/bootstrap.css">
    <script src="${js}/jquery.js"></script>
    <script src="${js}/pintuer.js"></script>
    <script src="${js}/bootstrap.js"></script>
</head>
<body>
<form method="post" action="${root}/orders/list" id="listform">
    <div class="panel admin-panel">
        <div class="panel-head"><strong class="icon-reorder"> 内容列表</strong></div>
        <div class="padding border-bottom">
            <ul class="search">
                <li>搜索：</li>
                <li>订单总额：
                    <input name="minPrice" value="${orderVo.minPrice}" class="input" style="width:60px;  display:inline-block"/>--<input name="maxPrice" value="${orderVo.maxPrice}" class="input" style="width:60px;  display:inline-block"/>
                </li>
                <li>订单完成时间：
                    <input name="startOrderDate" value="<fmt:formatDate value="${orderVo.startOrderDate}" pattern="yyyy-MM-dd HH:mm:ss"/>" class="input" style="width:250px;  display:inline-block"/>--<input name="endOrderDate" value="<fmt:formatDate value="${orderVo.endOrderDate}" pattern="yyyy-MM-dd HH:mm:ss"/>" class="input" style="width:250px;  display:inline-block"/>
                </li>
                <li>订单号：
                    <input type="text" placeholder="请输入订单号" name="oid" value="${orderVo.oid}" class="input" style="width:250px; display:inline-block" />
                    <input class="button border-main icon-search" type="submit" value="搜索">
                    <a href="" class="button border-main icon-bar" type="submit">清除</a>
                </li>
            </ul>
        </div>
        <table class="table table-hover text-center">
            <tr>
                <th>订单号</th>
                <th>卖家账号</th>
                <th>订单时间</th>
                <th>总价</th>
                <th>状态</th>
            </tr>
            <c:forEach items="${orders}" var="info">
                <tr class="tr_button">
                    <td>${info.oid}</td>
                    <td>${info.username}</td>
                    <td><fmt:formatDate value="${info.orderdate}" pattern="yyyy/MM/dd HH:mm:ss"/></td>
                    <td>${info.total}</td>
                    <td>
                        <c:if test="${info.paycode==1}"><span color="blue">已支付</span></c:if>
                        <c:if test="${info.paycode==0}"><span color="red">未支付</span></c:if>
                    </td>
                </tr>
                <tr class="target">
                    <td colspan="4">
                        <table class="table table-bordered">
                            <tr>
                                <th colspan="5" class="info">下面是${info.oid}号的订单信息</th>
                            </tr>
                            <c:forEach items="${info.orderItemList}" var="items">
                                <tr>
                                    <td>商品号:${items.oiid}</td>
                                    <td>商品名称:${items.title}</td>
                                    <td>单价:${items.price}</td>
                                    <td>数量:${items.num}</td>
                                    <td>小计:${items.subtotal}</td>
                                </tr>
                            </c:forEach>
                        </table>
                    </td>
                </tr>
            </c:forEach>
            <tr>
                <td colspan="7">
                    <div class="pagelist">
                        当前<span class="text-big">${pageInfo.getPageNum()}/${pageInfo.getPages()}</span>页
                        <a href="${root}/orders/list?currentPage=1&minPrice=${orderVo.minPrice}&maxPrice=${orderVo.maxPrice}&oid=${orderVo.oid}&startOrderDate=${orderVo.startOrderDate}&endOrderDate=${orderVo.endOrderDate}">首页</a>
                        <a href="${root}/orders/list?currentPage=${pageInfo.getPageNum() - 1}&minPrice=${orderVo.minPrice}&maxPrice=${orderVo.maxPrice}&oid=${orderVo.oid}&startOrderDate=${orderVo.startOrderDate}&endOrderDate=${orderVo.endOrderDate}">上一页</a>
                        <c:forEach begin="${startPage}" end="${endPage}" var="step" step="1">
                            <c:if test="${pageInfo.getPageNum()==step}">
                                <strong class="text-red">${step}</strong>
                            </c:if>
                            <c:if test="${pageInfo.getPageNum()!=step}">
                                <a href="${root}/orders/list?currentPage=${step}&minPrice=${orderVo.minPrice}&maxPrice=${orderVo.maxPrice}&oid=${orderVo.oid}&startOrderDate=${orderVo.startOrderDate}&endOrderDate=${orderVo.endOrderDate}">${step}</a>
                            </c:if>
                        </c:forEach>
                        <a href="${root}/orders/list?currentPage=${pageInfo.getPageNum() + 1}&minPrice=${orderVo.minPrice}&maxPrice=${orderVo.maxPrice}&oid=${orderVo.oid}&startOrderDate=${orderVo.startOrderDate}&endOrderDate=${orderVo.endOrderDate}">下一页</a>
                        <a href="${root}/orders/list?currentPage=${pageInfo.getPages()}&minPrice=${orderVo.minPrice}&maxPrice=${orderVo.maxPrice}&oid=${orderVo.oid}&startOrderDate=${orderVo.startOrderDate}&endOrderDate=${orderVo.endOrderDate}">尾页</a>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</form>
<script type="text/javascript">
    $(function(){
        var i = 0;
        var flag=0;
        if(i==0){
            $(".target").hide();
        }
        $(".tr_button").click(function () {
            i=1;
            if (flag==0){
                $(this).next().show();
                flag=1;
            }else{
                $(this).next().hide();
                flag=0;
            }

        })
    });
</script>
</body>
</html>
